package clase;


import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.net.ServerSocket;
import java.net.Socket;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author snake_gt
 */
public class Servidor {

    public static void main(String[] args) {
        try {
            ServerSocket servidor = new ServerSocket(9999);
            
                Socket s = servidor.accept();
                System.out.println("Cliente Aceptado!!!!");
                DataInputStream entrada = new DataInputStream(s.getInputStream());
                int x= Integer.parseInt(entrada.readUTF());
                int y= Integer.parseInt(entrada.readUTF());
                int z=Integer.parseInt(entrada.readUTF());
                int r=(int)Math.max(Math.max(x, y),Math.max(y, z));
                DataOutputStream salida = new DataOutputStream(s.getOutputStream());
                salida.writeUTF("El mayopr es"+r);
                s.close();
            
        } catch (Exception e) {
            System.out.println("El puerto ya esta ocupado");
        }
    }
}
